 function search(){

		document.indexForm.submit();	 
	 }
function trim(val)
 {
	return val.replace(/(\s*$)/g, "");  
}

function checkInfo(){
	if(trim(document.getElementById("area_name").value)=="")
	{
	  alert("区域名称不能为空！");
	  document.getElementById("area_name").focus();
	  return false;
	}
	if(document.getElementById("sort_no").value == "")
	{
	  alert("排序不可以为空！");
	  document.getElementById("sort_no").focus();
	  return false;
	}		
}

 function delNewsInfo(){
 	var listsize = document.getElementById('listsize').value;
	var pkid_string = '';
	var down_area='0';
	for(var i=0;i<listsize;i++){
		if(document.getElementById('checkone'+i).checked){
			pkid_string += document.getElementById('checkone'+i).value+'|';
		  var ifdown= document.getElementById('existSonArea'+i);
			if(ifdown !=null && ifdown.value=='1')
			{
			   down_area =1;
			}				
		}
	}
	if(pkid_string == ''){
		alert('请至少选择一条!');
		return false;
	}
	document.getElementById('pkid').value = pkid_string;
	document.indexForm.action='/doTradeReg.do'; 
  if(down_area == 1)
  {
		  if(confirm("所选中区域含有下级区域，删除时下级区域也会一并删除！"))
		  {
		    document.indexForm.submit();
	    }
	} 
	else 
	{
		 if(window.confirm('确认删除吗?'))
		 {
		   document.indexForm.submit();
	   }
	}	
}

function delOneNews(val1,val2){
	  var ifdown= document.getElementById('existSonArea'+val1);		
		if(ifdown !=null && ifdown.value=='1')
		{
			if(confirm("所选中区域含有下级区域，删除时下级区域也会一并删除！"))
		  {
		     window.location.href='/doTradeReg.do?pkid='+val2+'&bpm_id=5855';
	    }		
	  }	
		else	 
		{ 
        if(window.confirm('确认删除吗?')
)
        {
       	  window.location.href='/doTradeReg.do?pkid='+val2+'&bpm_id=5855'; 
        } 		
    }
} 

 function sortNews(val)
 {
    var elem=val.form.elements;
    var all_news_text='';
    for(i=0;i<elem.length;i++)
    {
        if(elem[i].type=="text" && elem[i].id!="s_areaname")
        {
      	   all_news_text +=elem[i].id+','+elem[i].value+'|';
        }
    }
    //alert(all_news_text);
    document.indexForm.action='/doTradeReg.do';
    document.getElementById("sort").value=all_news_text;
    document.getElementById("bpm_id").value='2517';
    document.indexForm.submit();
 }